package com.wc.fortnight_blue_bridge.Q240518.D_拔苗助长;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/5/18 20:19
 * @description https://www.lanqiao.cn/problems/18489/learning/?contest_id=185
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010, M = (int) 1e6 + 10;
    static int[] a = new int[N];
    static int[] primes = new int[N];
    static boolean[] st = new boolean[M];
    static int idx = 0;
    static int n;


    static void ola() {
        st[0] = st[1] = true;
        for (int i = 2; i <= M - 1; i++) {
            if (!st[i]) primes[++idx] = i;
            for (int j = 1; primes[j] <= (M - 1) / i; j++) {
                st[i * primes[j]] = true;
                if (i % primes[j] == 0) break;
            }
        }
    }

    public static void main(String[] args) {
        ola();
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
        Map<Integer, Integer> map = new HashMap<>();
        Arrays.sort(a, 1, n + 1);
        int first = 1;
        while (a[first] == 1) first++;
        if (first == n + 1) {
            System.out.println(0);
            return;
        }
        long res = 0;
        int x = a[first];
        for (int j = 1; primes[j] <= x / primes[j]; j++) {
            if (x % primes[j] == 0) {
                int cnt = 0;
                while (x % primes[j] == 0) {
                    cnt++;
                    x /= primes[j];
                }
                map.put(primes[j], cnt);
            }
        }
        if (x > 1) map.put(x, 1);
        if (first == n) {
            for (int prime : map.keySet()) {
                if (map.get(prime) % 2 == 0) {
                    res++;
                }
            }
            System.out.println(res);
            return;
        }

        long preNum = a[first];
        for (int i = first + 1; i <= n; i++) {
            x = a[i];
            Map<Integer, Integer> tmp = new HashMap<>();
            Map<Integer, Integer> tmp2 = new HashMap<>();
            for (int j = 1; primes[j] <= x / primes[j]; j++) {
                if (x % primes[j] == 0) {
                    int cnt = 0;
                    while (x % primes[j] == 0) {
                        cnt++;
                        x /= primes[j];
                    }
                    tmp.put(primes[j], cnt);
                    tmp2.put(primes[j], cnt);
                }
            }
            if (x > 1) {
                tmp.put(x, 1);
                tmp2.put(x, 1);
            }
            for (int prime : map.keySet()) {
                tmp2.put(prime, tmp2.getOrDefault(prime, 0) + map.get(prime));
            }
            long nowNum = 1;

            for (int prime : tmp2.keySet()) {
                if (tmp2.get(prime) % 2 != 0) {
                    res++;
                    nowNum *= prime;
                    tmp.put(prime, tmp.getOrDefault(prime, 0) + 1);
                }
            }

            if (nowNum * a[i] > preNum) {
                preNum = nowNum * a[i];
                map = tmp;
            }
        }
        out.println(res);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
